package com.sh.caryr.erp.entity.stock;

import com.baomidou.mybatisplus.annotations.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.sh.caryr.erp.entity.enums.SkuRecordHandleType;
import com.sh.caryr.erp.entity.enums.SkuRecordOrderType;
import com.sh.caryr.erp.util.DateUtils;
import com.sh.caryr.erp.util.ERPConstants;
import com.sh.caryr.erp.util.UtilityTool;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.io.Serializable;
import java.util.Date;

/**
 * <p>
 * sku流水表
 * </p>
 *
 * @author milkeeper
 * @since 2017-12-01
 */
@TableName("erp_sku_record")
@NoArgsConstructor
@AllArgsConstructor
@Data
@Builder(builderClassName = "builder")
public class SkuRecord implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 序号
     */
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;
    /**
     * 公司代码
     */
    private String coco;
    /**
     * 商家编码
     */
    private String code;
    /**
     * 商品名称
     */
    private String name;
    /**
     * skuID
     */
    private Long skuId;
    /**
     * 仓库ID
     */
    private Long storageId;
    /**
     * 订单类型，收货单：1，交易订单：2，退货单：3，采购退货单：4，无单：5
     */
    private SkuRecordOrderType type;
    /**
     * 订单ID
     */
    private Long orderId;
    /**
     * 操作类型，入库1，锁定2，出库3，次品4，新增5，更新6，删除7
     */
    private SkuRecordHandleType handleType;
    /**
     * 操作数量
     */
    private Float handleAmount;
    /**
     * 总数量
     */
    private Float usableAmount;
    /**
     * 次品数量
     */
    private Float notGoodAmount;
    /**
     * 锁定数量
     */
    private Float lockedAmount;
    /**
     * Is deleted.
     */
    @Builder.Default
    private Integer isActive = ERPConstants.ENITYT_ACTIVE;
    /**
     * 操作时间
     */
    @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DateUtils.DATE_FORMAT_FULL)
    private Date handleTime;
    /**
     * 操作用户ID
     */
    private Long handleBy;
    /**
     * 备注
     */
    private String remark;

}
